<?php



/*
 *
 * fix portalid in portletpage table
$sSql="SELECT portalId,id  FROM portal_pages";

//echo $sSql."<br/>";
$rss=$GLOBALS["conn"]->Execute($sSql);

while (!$rss->EOF)  {

    $porid=$rss->fields["portalId"];
    $pgid=$rss->fields["id"];
    $sql="UPDATE portal_portletpage SET portalId = $porid WHERE portal_portletpage.pageId = $pgid ";
    echo sql;
    $GLOBALS["conn"]->Execute($sql);
    $rss->MoveNext();
}
*/


        $category=getParameter("category");



$SQL="SELECT
ammn_casclinique.title,
ammn_casclinique.id,
ammn_casclinique.auteur,
DATE_FORMAT(ammn_casclinique.date, '%d/%m/%Y') as date
FROM
ammn_category
INNER JOIN ammn_casclinique ON ammn_casclinique.categoryId = ammn_category.id
WHERE
ammn_category.category = '$category' AND  ammn_category.portalId = $portalId Order by date desc";
//echo $SQL;
Portal_log($SQL);
$rs=ew_LoadRecordset($SQL);

if ($rs && $rs->RecordCount()>0) {



    ?>
<h1><?php echo getObjByKey("ammn_category","Lib","category",$category,"portalId",$portalId)?></h1>
<table class="zebra" border="0" cellspacing="0" cellpadding="0">

    <thead>
    <tr>
        <th align="left"><a href="#" onclick="Joomla.tableOrdering('a.title','asc','');" title="Cliquez pour trier cette colonne">Titre</a></th>


        <th align="left" width="20%"><a href="#" onclick="Joomla.tableOrdering('author','asc','');" title="Cliquez pour trier cette colonne">Auteur</a></th>

        <th align="center" width="5%"><a href="#" onclick="Joomla.tableOrdering('a.hits','asc','');" title="Cliquez pour trier cette colonne">Date</a></th>

    </tr>
    </thead>

    <tbody>



	<?php

$count=$rs->RecordCount();
//echo $count;

    ?><ul><?php
$i=0;
 while ( !$rs->EOF)  { 
 	$class="odd";
     if ($i%2) $class="even";
$i++;
?>

     <tr class="<?php echo $class; ?>">


         <td>
             <a href="/casclinique/cas-<?php echo $rs->fields["id"]; ?>.html"><?php echo $rs->fields["title"];   ?></a>
         </td>


         <td>

             <?php echo $rs->fields["auteur"];   ?>
         </td>

         <td align="center"><?php echo $rs->fields["date"];   ?></td>


     </tr>


<?php
			
		  $rs->MoveNext();    
		  }

        ?>

    </tbody>

</table><br/><?php

    }else{

    if ($displayed_categories){
    ?>
    Aucun Cas Clinique trouvé.<a href="/cascliniques.html">Retour</a>
    <?php
}}



        ?>